﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>无标题页</title>
    <script type="text/javascript">
    function AddComment()
    {
        var nickName = document.getElementById("nickName").value;
        var comment = document.getElementById("comment").value;
        var tablelinks = document.getElementById("tablelinks");
        var tr = tablelinks.insertRow(-1);
        
        var td1 = tr.insertCell(-1);
        td1.innerHTML = nickName+":";
    
        var td2 = tr.insertCell(-1);
        td2.innerHTML = comment;    
    }
    
    function AddComment2()
    {
        var nickName = document.getElementById("nickName").value;
        var comment = document.getElementById("comment").value;
        var tablelinks = document.getElementById("tablelinks");
        
        var tr = document.createElement("tr");
        var td1 = document.createElement("td");
        td1.innerHTML = nickName+":";
        tr.appendChild(td1);
        
        var td2 = document.createElement("td");
        td2.innerHTML = comment;
        tr.appendChild(td2);
        
        tablelinks.tBodies[0].appendChild(tr);
    }
    </script>
</head>
<body>
新闻------新闻------新闻------新闻------新闻------新闻------新闻------新闻------新闻------新闻------新闻
<p>评论区：</p>
<table id="tablelinks">
    <tbody>
        <tr>
        <td>喵喵：</td><td>沙发耶</td>
        </tr>
    </tbody>    
</table>
昵称:<input type="text" id="nickName" />
<br />
<textarea id="comment">
</textarea>
<input type="button" value="评论" onclick="AddComment2()"/>
</body>
</html>
